package com.hrms.core;

import java.util.Arrays;
import java.util.List;

public class RoleManager {

	private RoleManager() {

	}
	public static enum ROLE{
		NORM, SUPERVISOR, HR
	}

	public static final Role NORM = new Role(ROLE.NORM.name(), 
			Constants.TEAM_DASHBOARD);
	
	public static final Role SUPERVISOR = new Role(ROLE.SUPERVISOR.name(), NORM,
			Constants.TEAM_DASHBOARD);
	
	public static final Role HR = new Role(ROLE.HR.name(), NORM,
			Constants.MANAGE_EMPLOYEE, 
			Constants.TEAM_DASHBOARD);

	public static final List<Role> ROLES = Arrays.asList(NORM, SUPERVISOR, HR);

	public static Role findRole(String role) {
		for (Role r : ROLES) {
			if (r.getName().equals(role)) {
				return r;
			}
		}
		return null;
	}

}
